<template>
  <div>
    <div class="form">
      <div class="search">
        <div class="date_picker">
          <!-- <el-input placeholder="" v-model="studentName" class="search_info">
            <i slot="prefix" class="el-input__icon el-icon-search"></i>
          </el-input> -->
          <el-input placeholder="标题" v-model="title" class="search_info">
            <i slot="prefix" class="el-input__icon el-icon-search"></i>
          </el-input>
          <!-- <el-input placeholder="班级名称" v-model="className" class="search_info">
            <i slot="prefix" class="el-input__icon el-icon-search"></i>
          </el-input> -->
        </div>
        <div>
          <el-button @click="reset()" class="searchBtn">重置</el-button>
          <el-button type="primary" @click="getList(1)" class="searchBtn"
            >搜索</el-button
          >
          <el-button type="primary" @click="add()" class="searchBtn"
            >新增</el-button
          >
        </div>
      </div>
      <el-table
        class="listTable"
        v-loading="listLoading"
        :data="list"
        border
        fit
        highlight-current-row
        style="width: 100%"
      >
        <el-table-column label="序号" type="index" align="center">
        </el-table-column>
        <el-table-column label="考点标题" prop="id" align="center">
          <template slot-scope="{ row }">
            <span>{{ row.title }}</span>
          </template>
        </el-table-column>
         <!-- <el-table-column label="所属课程" align="center">
          <template slot-scope="{ row }">
            <span>{{ row.level }}</span>
          </template>
        </el-table-column> -->
        <el-table-column label="学习人数" align="center">
          <template slot-scope="{ row }">
            <span>{{ row.learnNumber }}</span>
          </template>
        </el-table-column>
        <el-table-column label="封面图片" align="center">
          <template slot-scope="{ row }">
            <img
              style="width: 200px"
              :src="'https://www.xlpx.org.cn/fire/image/' + row.titleImageUrl"
            />
            <!-- <span>{{ row.titleImageUrl }}</span> -->
          </template>
        </el-table-column>
        <el-table-column label="实操详情" align="center">
          <template slot-scope="{ row }">
            <div style="color:#2e82ff;cursor: pointer" @click="open('https://www.xlpx.org.cn/fire/image/' + row.detailImageUrl)">文件预览</div>
            <!-- <img
              style="width: 200px"
              :src=""
            /> -->
            <!-- <span>{{ row.detailImageUrl }}</span> -->
          </template>
        </el-table-column>
        <el-table-column
          label="操作"
          align="center"
          width="230"
          class-name="small-padding fixed-width"
        >
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-info"
              @click="edit(scope.row.id)"
              v-hasPermi="['financeProduct:product:edit']"
              >编辑</el-button
            >
            <el-button
              size="mini"
              type="text"
              icon="el-icon-delete"
              @click="del(scope.row.id)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        :total="total"
        layout="total, sizes, prev, pager, next"
        :page-size="limit"
        :page-sizes="[10, 20, 50, 100]"
        @size-change="handleSizeChange"
        :current-page.sync="curPage"
        @current-change="getList($event)"
        class="sortStyle"
      />
    </div>
  </div>
</template>

<script>
import { getOperationList, operationDel } from "@/api/system/user";
import {} from "@/api/article";
export default {
  components: {},
  data() {
    return {
      title: "",
      list: [],
      listLoading: false,
      total: 0,
      limit: 10,
      curPage: 1,
      listData: [],
      studentName: "",
      testPaperName: "",
      className: "",
    };
  },
  created() {},
  mounted() {
    this.getList(1);
  },
  methods: {
    reset() {
      this.title = "";
    },
    /** 查询列表 */
    getList(page) {
      let params = {
        pageNum: page,
        pageSize: this.limit,
        title: this.title,
      };
      this.listLoading = true;
      getOperationList(params).then((res) => {
        this.listLoading = false;
        if (res.code == 200) {
          this.list = res.rows;
          this.total = res.total;
        } else {
          this.$message({ message: res.msg, type: "error" });
        }
      });
    },
    preview(id) {
      this.$router.push({ path: "/answerDetail", query: { id: id } });
    },
    edit(id) {
      this.$router.push({ path: "/operationEdit", query: { id: id } });
    },
    open(val) {
      window.open(val)
    },
    del(id) {
      this.$confirm("确定删除该实操考点么？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        operationDel(id).then((res) => {
          if (res.code == "200") {
            this.$message({ message: res.msg, type: "success" });
            this.getList(1);
          } else {
            this.$message({ message: res.msg, type: "error" });
          }
        });
      });
    },
    handleSizeChange() {},
    add() {
      this.$router.push("/operationAdd");
    },
  },
};
</script>
<style scoped>
.form {
  padding-left: 26px;
  padding-right: 24px;
  padding-top: 24px;
  background: #fff;
}
.search {
  display: flex;
  position: relative;
}
.search_info {
  width: 192px;
  height: 40px;
  margin-right: 16px;
}
.searchBtn {
  margin-left: 16px;
  height: 36px;
}
.sortStyle {
  height: 19px;
  float: right;
  /* right: 24px; */
  margin-top: 20px;
  margin-bottom: 30px;
}
.pos_right_btn {
  position: absolute;
  right: 0;
}
.opt_font {
  cursor: pointer;
  color: #2e82ff;
}
.detail_title {
  font-size: 16px;
  font-weight: 400;
  color: #212121;
  line-height: 22px;
}
.detail_title span {
  padding-left: 4px;
  background: #1e88e5;
  margin-right: 12px;
}
.row {
  display: flex;
  padding-bottom: 12px;
}
.detail_info {
  padding-top: 16px;
}
.info_left {
  display: flex;
}
.info_right {
  display: flex;
  padding-left: 202px;
}
.info_left_title {
  font-size: 14px;
  font-weight: 400;
  color: #616161;
  line-height: 20px;
  width: 112px;
  margin-right: 16px;
}
.info_left_content {
  font-size: 14px;
  font-weight: 400;
  color: #212121;
  line-height: 20px;
  width: 150px;
}
.pos_top {
  padding-top: 12px;
}
.detailTable {
  margin-top: 16px;
}
.opt_font {
  color: #1e88e5;
  cursor: pointer;
}
.page_pos {
  text-align: right;
  padding-top: 10px;
}
.backBtn {
  text-align: center;
  margin-top: 10px;
}
/deep/ .el-dialog {
  display: flex;
  flex-direction: column;
  margin: 0 !important;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-height: calc(100% -30px);
  /* max-width: ; */
}
/deep/ .el-dialog .el-dialog__body {
  flex: 1;
  height: 700px;
  overflow-y: auto;
  padding-top: 0;
}
.tab {
  display: flex;
  position: absolute;
  right: 32px;
  top: 14px;
}
.tab_border {
  border: 1px solid #409eff;
  color: #409eff;
  padding: 10px 12px;
  font-size: 14px;
  margin-right: 16px;
}
.change {
  border: 1px solid #f56c6c;
  color: #f56c6c;
}
.listTable {
  margin-top: 17px;
}
</style>
